namespace Brjnk.Common
{
    using System.ComponentModel;
    using System.Windows;
    using Brjnk.Common.UI;

    /// <summary>
    /// </summary>
    public class PaperSize : INotifyPropertyChanged
    {
        private double width;

        /// <summary>
        /// Centimeters
        /// </summary>
        public double Width
        {
            get { return width; }
            set { width = value; OnPropertyChanged("Width"); }
        }

        private double height;

        /// <summary>
        /// Centimeters
        /// </summary>
        public double Height
        {
            get { return height; }
            set { height = value; OnPropertyChanged("Height"); }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        protected void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }

        public Size ToDip()
        {
            var w = DIPHelper.GetDipFromCm(Width);
            var h = DIPHelper.GetDipFromCm(Height);
            return new Size(w, h);
        }
    }
}